if(sscanf(params, "s", pstatus)) return SendClientMessage(playerid, 0xFFFFFF00, "USAGE: /pizza [out/in]");
if(!strcmp(pstatus, "out", true, 3))
{
GetPlayerPos(playerid, x, y, z);
cobjectid = CreateObject(1582, x, y, z, 0, 0, 0);
AttachObjectToPlayer(cobjectid, playerid, OffsetX-0.1, OffsetY+0.18, OffsetZ-0.05, -90, 0, 0);
}
else if(!strcmp(pstatus, "in", true, 2))
{
DestroyObject(cobjectid);
}
CMD:penis(playerid, params[])
{
new pstatus[32];
new cobjectid;
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))
{
GetPlayerPos(playerid, x, y, z);
cobjectid = CreateObject(322, x, y, z, 0, 0, 0);
AttachObjectToPlayer(cobjectid, 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))
{
DestroyObject(cobjectid);
format(message, sizeof(message), "AdmCmd: %s has put his penis in.", ReturnPlayerName(playerid));
SendClientMessageToAll(COLOR_LIGHTRED, message);
}
return 1;
}
|
yeah take new cobjectid;
out of the command and make it global by putting at the top of the script outside of all function most likely there will be some there allready and that should fix soory you will need to make it new cobjectid[MAX_PLAYERS]; and then call: cobjectid[playerid] else you will del the objectid when another player uses it *edit *edit *edit |
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;
}