01.01.2010, 01:07
Code: ( Somewhere in script but not in any callbacks - for DCMD)
dcmd_gotoposition(playerid,params[]) {
if(IsPlayerAdmin(playerid)) {
new Float, Float:y, Float:z, world, interior;
new tmp[256], tmp2[256], tmp3[256], tmp4[256], tmp5[256];
new string[128], Index; tmp = strtok(params,Index); tmp2 = strtok(params,Index); tmp3 = strtok(params,Index); tmp4 = strtok(params,Index); tmp5 = strtok(params,Index);
if(!strlen(tmp) || !strlen(tmp2) || !strlen(tmp3)) || !(strlen(tmp4)) || !strlen(tmp5)) return SendClientMessage(playerid,red,"USAGE: /lgoto [x] [y] [z]");
x = strval(tmp) y = strval(tmp2); z = strval(tmp3); interior = strval(tmp4); world(tmp5);
SetPlayerInterior(playerid, interior);
if(GetPlayerState(playerid) == 2) SetVehiclePos(GetPlayerVehicleID(playerid),x,y,z); LinkVehicleToInterior(GetPlayerVehicleID(playerid) , interior);
else SetPlayerPos(playerid,x,y,z);
format(string,sizeof(string),"You have teleported to %f, %f, %f in interior universe %d ini virtual world %d", x,y,z, interior, world); return SendClientMessage(playerid,0xFFFFFFFF,string);
} else return 0;
}
Code: (Under OnPlayerCommandText)
dcmd(gotoposition, 12, cmdtext);
dcmd_gotoposition(playerid,params[]) {
if(IsPlayerAdmin(playerid)) {
new Float, Float:y, Float:z, world, interior;
new tmp[256], tmp2[256], tmp3[256], tmp4[256], tmp5[256];
new string[128], Index; tmp = strtok(params,Index); tmp2 = strtok(params,Index); tmp3 = strtok(params,Index); tmp4 = strtok(params,Index); tmp5 = strtok(params,Index);
if(!strlen(tmp) || !strlen(tmp2) || !strlen(tmp3)) || !(strlen(tmp4)) || !strlen(tmp5)) return SendClientMessage(playerid,red,"USAGE: /lgoto [x] [y] [z]");
x = strval(tmp) y = strval(tmp2); z = strval(tmp3); interior = strval(tmp4); world(tmp5);
SetPlayerInterior(playerid, interior);
if(GetPlayerState(playerid) == 2) SetVehiclePos(GetPlayerVehicleID(playerid),x,y,z); LinkVehicleToInterior(GetPlayerVehicleID(playerid) , interior);
else SetPlayerPos(playerid,x,y,z);
format(string,sizeof(string),"You have teleported to %f, %f, %f in interior universe %d ini virtual world %d", x,y,z, interior, world); return SendClientMessage(playerid,0xFFFFFFFF,string);
} else return 0;
}
Code: (Under OnPlayerCommandText)
dcmd(gotoposition, 12, cmdtext);