19.08.2009, 10:22
pawn Код:
if(strcmp(cmd, "/up", true) == 0){
if(IsPlayerAdmin(playerid){
new tmp[128],height;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))return SendClientMessage(playerid, color, "USE: /up [playerid] [height]");
giveplayerid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))return SendClientMessage(playerid, color, "USE: /up [playerid] [height]");
height = strval(tmp);
if(!IsPlayerConnected(giveplayerid))return SendClientMessage(playerid, color,"Bad Playerid");
new Float:x,Float:y,Float:z;
GetPlayerPos(giveplayerid,x,y,z);
SetPlayerPos(giveplayerid,x,y,z+height);
}else{
SendClientMessage(playerid, color,"ERROR: ADMIN_ACCESS_REQUIERED");
}
return 1;
}
here u have a more "advanced" and tested one:
pawn Код:
if(strcmp(cmd, "/upingp", true)==0 && IsPlayerAdmin(playerid)) {
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, color, "USE: /upingp [playerid] [height 1 - 20000]");
}else{
if(!IsPlayerConnected(strval(tmp))) {
SendClientMessage(playerid, color, "Bad Playerid");
} else {
new newz;
static Float:X;
static Float:Y;
static Float:Z;
new VehicleID;
tmp2 = strtok(cmdtext, idx);
newz = strval(tmp2);
if(!newz) {
SendClientMessage(playerid, color, "USE: /upingp [playerid] [height 1 - 20000]");
return 1;
}
if(newz >20000 || newz <1) {
SendClientMessage(playerid, color, "USE: /upingp [playerid] [height 1 - 20000]");
}else {
if(IsPlayerInAnyVehicle(strval(tmp))) {
SetPlayerInterior(strval(tmp), 0);
GetPlayerPos(strval(tmp), X, Y, Z);
new inte;
inte = GetPlayerInterior(strval(tmp));
SetPlayerInterior(strval(tmp), inte);
VehicleID = GetPlayerVehicleID(strval(tmp));
SetVehiclePos(VehicleID,X,Y, Z+newz);
} else {
new inte;
inte = GetPlayerInterior(strval(tmp));
SetPlayerInterior(strval(tmp), inte);
GetPlayerPos(strval(tmp),X, Y,Z);
SetPlayerPos(strval(tmp),X,Y,Z+newz);
}
}
}
}
return 1;
}
