Пример #1
0
void PlayerCmd_GetUid(scr_entref_t arg){

    gentity_t* gentity;
    int entityNum = 0;
    int uid;
	mvabuf;

	
    if(HIWORD(arg)){

        Scr_ObjectError("Not an entity");

    }else{

        entityNum = LOWORD(arg);
        gentity = &g_entities[entityNum];

        if(!gentity->client){
            Scr_ObjectError(va("Entity: %i is not a player", entityNum));
        }
    }
    if(Scr_GetNumParam()){
        Scr_Error("Usage: self getUid()\n");
    }

    uid = SV_GetUid(entityNum);

    if(uid < 1)
    {
        Scr_AddInt(-1);
        return;
    }

    Scr_AddInt(uid);
}
Пример #2
0
void PlayerCmd_GetPower(scr_entref_t arg){

    gentity_t* gentity;
    int entityNum = 0;
    int power;
    client_t *cl;
	mvabuf;


    if(HIWORD(arg)){

        Scr_ObjectError("Not an entity");

    }else{

        entityNum = LOWORD(arg);
        gentity = &g_entities[entityNum];

        if(!gentity->client){
            Scr_ObjectError(va("Entity: %i is not a player", entityNum));
        }
    }
    if(Scr_GetNumParam()){
        Scr_Error("Usage: self getPower()\n");
    }
    cl = &svs.clients[entityNum];

    power = SV_RemoteCmdGetClPower(cl);

    Scr_AddInt(power);
}
Пример #3
0
void PlayerCmd_spawn(scr_entref_t arg){

    gentity_t* gentity = NULL;
    vec3_t position;
    vec3_t direction;
	mvabuf;

    int entityNum = 0;

    if(HIWORD(arg)){

        Scr_ObjectError("Not an entity");

    }else{

        entityNum = LOWORD(arg);
        gentity = &g_entities[entityNum];

        if(!gentity->client){
            Scr_ObjectError(va("Entity: %i is not a player", entityNum));
        }
    }

    Scr_GetVector(0, position);
    Scr_GetVector(1, direction);

    ClientSpawn(gentity, position, direction);

}
Пример #4
0
void PlayerCmd_GetUserinfo(scr_entref_t arg){

    gentity_t* gentity;
    int entityNum = 0;
    client_t *cl;
	mvabuf;


    if(HIWORD(arg)){

        Scr_ObjectError("Not an entity");

    }else{

        entityNum = LOWORD(arg);
        gentity = &g_entities[entityNum];

        if(!gentity->client){
            Scr_ObjectError(va("Entity: %i is not a player", entityNum));
        }
    }
    if(Scr_GetNumParam() != 1){
        Scr_Error("Usage: self getUserinfo( <string> )\n");
    }

    char* u_key = Scr_GetString(0);

    cl = &svs.clients[entityNum];

    char* value = Info_ValueForKey(cl->userinfo, u_key);

    Scr_AddString(value);
}
Пример #5
0
void PlayerCmd_GetGeoLocation(scr_entref_t arg){

    gentity_t* gentity;
    int entityNum = 0;
    int rettype;
    int locIndex;
    const char* countryname;
	mvabuf;

    if(HIWORD(arg)){

        Scr_ObjectError("Not an entity");
        return;

    }else{

        entityNum = LOWORD(arg);
        gentity = &g_entities[entityNum];

        if(!gentity->client){
            Scr_ObjectError(va("Entity: %i is not a player", entityNum));
            return;
        }
    }

    if(Scr_GetNumParam() != 1){
        Scr_Error("Usage: self getgeolocation( <integer> )\n");
    }

    rettype = Scr_GetInt(0);

    locIndex = _GeoIP_seek_record(BigLong(*(unsigned long*)&svs.clients[entityNum].netchan.remoteAddress.ip));

    switch(rettype){
        case SCR_GEOIP_CODE:
            countryname = _GeoIP_country_code(locIndex);
            break;

        case SCR_GEOIP_CODE3:
            countryname = _GeoIP_country_code3(locIndex);
            break;

        case SCR_GEOIP_COUNTRYNAME:
            countryname = _GeoIP_country_name(locIndex);
            break;

        case SCR_GEOIP_CONTINENT:
            countryname = _GeoIP_continent_name(locIndex);
            break;

        default:
            Scr_AddInt(locIndex);
            return;
    }
    Scr_AddString(countryname);
}
Пример #6
0
/*
============
PlayerCmd_SetGroundReferenceEnt

The ground entity's rotation will be added onto the player's view. 
In particular, this will cause the player's yaw to rotate around the 
entity's z-axis instead of the world z-axis. You only need to call 
this function once. After that, any rotation that the reference entity 
undergoes will affect the player. Setting it back to 0 (worldspawn)
should disable all further effects.

Usage:	self SetGroundReferenceEnt( <other entity id> );
		self SetGroundReferenceEnt( other GetEntityNumber() );
============
*/
void PlayerCmd_SetGroundReferenceEnt(scr_entref_t arg)
{
	gentity_t* gentity, *groundRefEnt;
    int entityNum = 0;
	int otherEntityNum = 0;
	mvabuf;

    if(HIWORD(arg)){
        Scr_ObjectError("Not an entity");
        return;

    }else{
        entityNum = LOWORD(arg);
        gentity = &g_entities[entityNum];

        if(!gentity->client){
            Scr_ObjectError(va("Entity: %i is not a player", entityNum));
            return;
        }
    }

    if(Scr_GetNumParam() != 1){
        Scr_Error("Usage: self SetGroundReferenceEnt( <entity id> )\n");
    }

	otherEntityNum = Scr_GetInt(0);
    if( otherEntityNum >= 1024 || otherEntityNum < 0 ){
        Scr_Error( "SetGroundReferenceEnt must be in range 0-1023\n" );
        return;
    }

	groundRefEnt = &g_entities[entityNum];
	if( groundRefEnt->client ){
		Scr_ObjectError(va("player entity %i can not be a ground reference entity", otherEntityNum));
		return;
	}

/*
	if( !groundRefEnt->inuse ){
		Scr_ObjectError(va("SetGroundReferenceEnt: entity %i does not exist", otherEntityNum));
		return;
	}
*/

	gentity->s.groundEntityNum = otherEntityNum;
}
void PlayerCmd_SetUid(scr_entref_t arg){

    gentity_t* gentity;
    int entityNum = 0;
    unsigned int uid;
    mvabuf;
	qboolean useoffset;

    if(HIWORD(arg)){

        Scr_ObjectError("Not an entity");

    }else{

        entityNum = LOWORD(arg);
        gentity = &g_entities[entityNum];

        if(!gentity->client){
            Scr_ObjectError(va("Entity: %i is not a player", entityNum));
        }
    }
	if(Scr_GetNumParam() == 2)
	{
		useoffset = Scr_GetInt(1);
	}else if(Scr_GetNumParam() != 1){
        Scr_Error("Usage: self setUid(<integer>)\n");
		useoffset = qfalse;
    }
	
    uid = Scr_GetInt(0);
	if(useoffset == qfalse)
	{
		if(uid >= 100000000)
		{
			Scr_Error("setUid: has to be in range between 0 and 9999999\n");
		}

		SV_SetUid(entityNum, uid + SCRIPT_UID_OFFSET);
		Scr_AddInt( uid + SCRIPT_UID_OFFSET );
	}else{
		SV_SetUid(entityNum, uid);
		Scr_AddInt( uid );
	}
}
Пример #8
0
void PlayerCmd_SetGravity(scr_entref_t arg){

    gentity_t* gentity;
    int entityNum = 0;
    int gravity;
	mvabuf;


    if(HIWORD(arg)){

        Scr_ObjectError("Not an entity");
        return;

    }else{

        entityNum = LOWORD(arg);
        gentity = &g_entities[entityNum];

        if(!gentity->client){
            Scr_ObjectError(va("Entity: %i is not a player", entityNum));
            return;
        }
    }

    if(Scr_GetNumParam() != 1){
        Scr_Error("Usage: self setgravity( <integer> )\n");
    }

    gravity = Scr_GetInt(0);

    if(gravity < 1 || gravity > 50000){
        Scr_Error("setgravity range is between 1 and 50000\n");
        return;
    }

    Pmove_ExtendedTurnOn();

    svs.clients[entityNum].gravity = gravity;

}
void PlayerCmd_SetJumpHeight(scr_entref_t arg){

    gentity_t* gentity;
    int entityNum = 0;
    int height;
	mvabuf;

    if(HIWORD(arg)){

        Scr_ObjectError("Not an entity");
        return;

    }else{

        entityNum = LOWORD(arg);
        gentity = &g_entities[entityNum];

        if(!gentity->client){
            Scr_ObjectError(va("Entity: %i is not a player", entityNum));
            return;
        }
    }

    if(Scr_GetNumParam() != 1){
        Scr_Error("Usage: self setjumpheight( <integer> )\n");
    }

    height = Scr_GetInt(0);

    if(height < 0 || height > 50000){
        Scr_Error("setjumpheight range is between 1 and 50000\n");
        return;
    }

    Pmove_ExtendedTurnOn();

    svs.clients[entityNum].jumpHeight = height;
    SV_SendServerCommand_IW(&svs.clients[entityNum], 1, va("v jump_height \"%d\"", height));
}
Пример #10
0
void PlayerCmd_SetMoveSpeed(scr_entref_t arg){

    gentity_t* gentity;
    int entityNum = 0;
    int speed;
	mvabuf;

    if(HIWORD(arg)){

        Scr_ObjectError("Not an entity");
        return;

    }else{

        entityNum = LOWORD(arg);
        gentity = &g_entities[entityNum];

        if(!gentity->client){
            Scr_ObjectError(va("Entity: %i is not a player", entityNum));
            return;
        }
    }

    if(Scr_GetNumParam() != 1){
        Scr_Error("Usage: self setmovespeed( <integer> )\n");
    }

    speed = Scr_GetInt(0);

    if(speed < 0 || speed > 50000){
        Scr_Error("setmovespeed range is between 0 and 50000\n");
        return;
    }

    Pmove_ExtendedTurnOn();

    svs.clients[entityNum].playerMoveSpeed = speed;
}
void PlayerCmd_SetPower(scr_entref_t arg){

    gentity_t* gentity;
    int entityNum = 0;
    int power;
    client_t *cl;
	mvabuf;


    if(HIWORD(arg)){

        Scr_ObjectError("Not an entity");

    }else{

        entityNum = LOWORD(arg);
        gentity = &g_entities[entityNum];

        if(!gentity->client){
            Scr_ObjectError(va("Entity: %i is not a player", entityNum));
        }
    }
    if(Scr_GetNumParam() != 1){
        Scr_Error("Usage: self setPower(<integer>)\n");
    }
    cl = &svs.clients[entityNum];

    power = Scr_GetInt(0);

    if(power < 1 || power > 100)
    {
        Scr_Error("setPower: has to be in range between 1 and 100\n");
    }

    cl->power = power;

}
Пример #12
0
void PlayerCmd_SetUid(scr_entref_t arg){

    gentity_t* gentity;
    int entityNum = 0;
    int uid;
    mvabuf;


    if(HIWORD(arg)){

        Scr_ObjectError("Not an entity");

    }else{

        entityNum = LOWORD(arg);
        gentity = &g_entities[entityNum];

        if(!gentity->client){
            Scr_ObjectError(va("Entity: %i is not a player", entityNum));
        }
    }
    if(Scr_GetNumParam() != 1){
        Scr_Error("Usage: self setUid(<integer>)\n");
    }

    uid = Scr_GetInt(0);

    if(uid >= 10000000)
    {
        Scr_Error("setUid: has to be in range between 0 and 9999999\n");
    }

    SV_SetUid(entityNum, uid + 100000000);

    Scr_AddInt( uid + 100000000 );
}
Пример #13
0
void HECmd_SetText(scr_entref_t entnum){

    char buffer[1024];

    if(HIWORD(entnum) != 1)
    {
        Scr_ObjectError("G_HudSetText: Not a hud element");
        return;
    }

    game_hudelem_t* element = &g_hudelems[LOWORD(entnum)];

    element->var_14 = 0;
    element->var_15 = 0;
    element->var_16 = 0;

    element->movex = 0;
    element->movey = 0;
    element->movealign = 0;
    element->movescralign = 0;

    element->var_18 = 0;
    element->var_19 = 0;
    element->var_20 = 0;
    element->var_21 = 0;

    element->var_28 = 0;
    element->var_29 = 0;
    element->var_30 = 0;

    element->hudTextConfigStringIndex = 0;

    Scr_ConstructMessageString(0,0, "Hud Elem String", buffer, sizeof(buffer));
    element->inuse = qtrue;
    element->hudTextConfigStringIndex = G_LocalizedStringIndex(buffer);

}