[HELP] Clothes - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Clothes (
/showthread.php?tid=114651)
[HELP] Clothes -
joeri55 - 20.12.2009
I've got a command but people can change other characters there skins..
How can I make that they can only change there own skin?
This is my code:
Код:
if(strcmp(cmd, "/clothes", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /clothes [playerid/PartOfName] [skin id]");
return 1;
}
new para1;
new level;
para1 = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
level = strval(tmp);
if(level > 299 || level < 1) { SendClientMessage(playerid, COLOR_GREY, "Wrong skin ID!"); return 1; }
if(IsAtClothShop(playerid))
{
if(IsPlayerConnected(para1))
{
if(para1 != INVALID_PLAYER_ID)
{
PlayerPlaySound(playerid, 1084, 0.0, 0.0, 0.0);
SafeGivePlayerMoney(playerid, -50);
SendClientMessage(playerid, COLOR_WHITE, " * Your skin has been changed!");
PlayerInfo[para1][pChar] = level;
GameTextForPlayer(playerid, "~w~Skin purchased", 5000, 1);
SetPlayerSkin(para1, PlayerInfo[para1][pChar]);
}
}//not connected
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You are not at the clothes shop!");
}
}
return 1;
}
If anyone has some tips or knows how to fix this please help meh!
Re: [HELP] Clothes -
Marcel - 20.12.2009
pawn Код:
if(strcmp(cmd, "/clothes", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /clothes [skin id]");
return 1;
}
new level;
level = strval(tmp);
if(level > 299 || level < 1)
{
SendClientMessage(playerid, COLOR_GREY, "Wrong skin ID!");
return 1;
}
if(IsAtClothShop(playerid))
{
PlayerPlaySound(playerid, 1084, 0.0, 0.0, 0.0);
SafeGivePlayerMoney(playerid, -50);
SendClientMessage(playerid, COLOR_WHITE, " * Your skin has been changed!");
PlayerInfo[playerid][pChar] = level;
GameTextForPlayer(playerid, "~w~Skin purchased", 5000, 1);
SetPlayerSkin(playerid, PlayerInfo[playerid][pChar]);
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You are not at the clothes shop!");
}
}
return 1;
}
Re: [HELP] Clothes -
joeri55 - 20.12.2009
You only changed the usage?
Re: [HELP] Clothes -
Marcel - 20.12.2009
I removed the playerid parameter because that's what you wanted right?