24.09.2010, 23:08
I have be thinking, i use
and
When i use them they work normal but i need to know the correct way to use it.
pawn Код:
if
pawn Код:
else and else if
if
else and else if
COMMAND:cuff(playerid, params[]) // or CMD:mycommand(playerid, params[])
{
new id,pskin = GetPlayerSkin(playerid),Float:x, Float:y, Float:z;
if(pskin == 265 || pskin == 266 || pskin == 267 || pskin == 280 || pskin == 281 || pskin == 284 || pskin == 285 || pskin == 286 || pskin == 287 || pskin == 288)
if(sscanf(params, "u",id)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /cuff [id]");
if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
else if(GetPlayerSkin(playerid))return SendClientMessage(playerid,0xFF0000FF,"ERROR: You dont have permisson to access this command.");
GetPlayerPos(id,x,y,z);
if(!IsPlayerInRangeOfPoint(id, 3, x, y, z))return SendClientMessage(playerid, 0xFF0000FF, "**You are not close enough to that player to cuff him.");
else if (IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You cannot ues this while in a vehicle.");
else if(TogglePlayerControllable(id,0))return SendClientMessage(id,0x8080FFFF,"**You have been restrained in handcuffs.");
Cuff[id] = 1;
{
GetPlayerPos(id,x,y,z);
}
return 1;
}
COMMAND:cuff(playerid, params[]) // or CMD:mycommand(playerid, params[])
{
new id,pskin = GetPlayerSkin(playerid),Float:x, Float:y, Float:z;
if(pskin == 265 || pskin == 266 || pskin == 267 || pskin == 280 || pskin == 281 || pskin == 284 || pskin == 285 || pskin == 286 || pskin == 287 || pskin == 288) { //changed - added a brace '{'
/* needs indention */ if(sscanf(params, "u",id)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /cuff [id]");
if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
else if(GetPlayerSkin(playerid))return SendClientMessage(playerid,0xFF0000FF,"ERROR: You don;t have permisson to access this command."); //Delete this whole line its not needed since you have getplayerskin up there.
GetPlayerPos(id,x,y,z); //This is ok.
if(!IsPlayerInRangeOfPoint(id, 3, x, y, z))return SendClientMessage(playerid, 0xFF0000FF, "**You are not close enough to that player to cuff him."); //This is ok too.
if (IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You cannot use this while in a vehicle."); //Changed - else if (isplayerinanyvehicle(playerid) wont work. Use as it is posted.
TogglePlayerControllable(id,0); SendClientMessage(id,0x8080FFFF,"**You have been restrained in handcuffs."); //This is epic fail line (no offense) else if(toggleplayercontrollable - fails terrible, use as i post.
Cuff[id] = 1;
} else return SendClientMessage(playerid,YOURCOLOR,"Sorry, you can not used this command."); //This is for the GetPlayerSkin at top, if they don't have them skins, it will send this message.
return 1;
}

for(new i = 0; i < INV_slots_allowed[playerid]; i ++) {
if(pInventory[playerid][i][ItemID] == INVALID_ITEM_ID) {
format(text, sizeof(text), "%s - Empty space -\r\n", text);
count += 2;
} else {
format(text, sizeof(text), "%s%s - Amount: %d\r\n", text, name, amount);
count += 3;
}
}
for(new i = 0; i < INV_slots_allowed[playerid]; i ++)
{
if(pInventory[playerid][i][ItemID] == INVALID_ITEM_ID)
{
format(text, sizeof(text), "%s - Empty space -\r\n", text);
count += 2;
} else
{
format(text, sizeof(text), "%s%s - Amount: %d\r\n", text, name, amount);
count += 3;
}
}