21.08.2012, 08:03
i have a cmd that if succeeded it sends a client message else another message
pawn Код:
COMMAND:sync(playerid, params[])
{
if(!IsPlayerInAnyVehicle(playerid)) {
new Float:x,Float:y,Float:z,intid,worldid;
new weaponsQ[MAX_PLAYERS][13][2];
GetPlayerPos(playerid,x,y,z);
intid = GetPlayerInterior(playerid);
worldid = GetPlayerVirtualWorld(playerid);
ClearAnimations(playerid);
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_NONE);
for (new i = 0; i < 13; i++) {
GetPlayerWeaponData(playerid,i,weaponsQ[playerid][i][0],weaponsQ[playerid][i][1]);
}
SpawnPlayer(playerid);
SetPlayerPos(playerid,x,y,z);
SetPlayerInterior(playerid,intid);
SetPlayerVirtualWorld(playerid,worldid);
for (new i = 0; i < 13; i++) {
GivePlayerWeapon(playerid,weaponsQ[playerid][i][0],weaponsQ[playerid][i][1]);
}
TogglePlayerControllable(playerid,1);
if(success) {
SendClientMessage(playerid,COLOR_GREEN,"success");
}
else {
SendClientMessage(playerid,COLOR_GREEN,"fail");
}
}
else {
new Float:x2,Float:y2,Float:z2,intid2,worldid2,vehicleid2;
new weaponsQ2[MAX_PLAYERS][13][2];
vehicleid2 = GetPlayerVehicleID(playerid);
GetVehiclePos(vehicleid2,x,y,z);
intid2 = GetPlayerInterior(playerid);
worldid2 = GetPlayerVirtualWorld(playerid);
ClearAnimations(playerid);
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_NONE);
for (new i = 0; i < 13; i++) {
GetPlayerWeaponData(playerid,i,weaponsQ2[playerid][i][0],weaponsQ[playerid][i][1]);
}
SetVehicleToRespawn(vehicleid2);
SetVehiclePos(vehicleid2,x2,y2,z2);
LinkVehicleToInterior(vehicleid2,intid2);
SetVehicleVirtualWorld(vehicleid2,worldid2);
for (new i = 0; i < 13; i++) {
GivePlayerWeapon(playerid,weaponsQ2[playerid][i][0],weaponsQ[playerid][i][1]);
}
TogglePlayerControllable(playerid,1);
if(success) {
SendClientMessage(playerid,COLOR_GREEN,"success");
}
else {
SendClientMessage(playerid,COLOR_GREEN,"fail");
}
}
}