pawn Код:
new cobjectid[MAX_PLAYERS];//move this to top of script
CMD:penis(playerid, params[])
{
new pstatus[32];
new Float:x, Float:y, Float:z;
new Float:OffsetX, Float:OffsetY, Float:OffsetZ;
new message[128];
if(sscanf(params, "s", pstatus)) return SendClientMessage(playerid, 0xFFFFFF00, "USAGE: /penis [Out/In]");
if(!strcmp(pstatus, "out", true, 3))
{
if(cobjectid[playerid] > 0) {
DestroyObject(cobjectid[playerid]);
cobjectid[playerid]=0;
}
GetPlayerPos(playerid, x, y, z);
cobjectid[playerid] = CreateObject(322, x, y, z, 0, 0, 0);
AttachObjectToPlayer(cobjectid[playerid], playerid, OffsetX-0.1, OffsetY+0.18, OffsetZ-0.05, -90, 0, 0);
format(message, sizeof(message), "AdmCmd: %s has put his penis out.", ReturnPlayerName(playerid));
SendClientMessageToAll(COLOR_LIGHTRED, message);
}
else if(!strcmp(pstatus, "in", true, 2))
{
cobjectid[playerid]=0;
DestroyObject(cobjectid[playerid]);
format(message, sizeof(message), "AdmCmd: %s has put his penis in.", ReturnPlayerName(playerid));
SendClientMessageToAll(COLOR_LIGHTRED, message);
}
return 1;
}
there ya go have a look what i did
define the varable out side the function makes it global and not recreated when the function runs
there ya go