08.04.2015, 11:04
Hey guys! ,Can someone help me in making a command can be typed once like,The player cant type it again e.g if I typed /mycommandon it will send a message,"error you already turned it on".I will REP of course .Thanks
CMD:test(playerid,params[]) { if(GetPVarInt(playerid,"testing") == 1) return SendClientMessage(playerid, -1, "You have already typed this command");// Check his player variable and if it's 1 it means he can't do the command and will send him this message! SetPVarInt(playerid, "testing", 1);// Sets the player's variable to 1 who performed this command. return 1; }
Example:-
Код:
CMD:test(playerid,params[]) { if(GetPVarInt(playerid,"testing") == 1) return SendClientMessage(playerid, -1, "You have already typed this command");// Check his player variable and if it's 1 it means he can't do the command and will send him this message! SetPVarInt(playerid, "testing", 1);// Sets the player's variable to 1 who performed this command. return 1; } |
COMMAND:turnon(playerid,params[]) { if(GetPVarInt(playerid,"textdrawon") == 1) return SendClientMessage(playerid, -1, "The textdraws are already on!"); SetPVarInt(playerid, "textdrawson", 1); Textdraw0[playerid] = CreatePlayerTextDraw(playerid,579.000000, 114.000000, "Health"); PlayerTextDrawBackgroundColor(playerid,Textdraw0[playerid], 255); PlayerTextDrawFont(playerid,Textdraw0[playerid], 1); PlayerTextDrawLetterSize(playerid,Textdraw0[playerid], 0.500000, 1.000000); PlayerTextDrawColor(playerid,Textdraw0[playerid], -1); PlayerTextDrawSetOutline(playerid,Textdraw0[playerid], 1); PlayerTextDrawSetProportional(playerid,Textdraw0[playerid], 1); PlayerTextDrawUseBox(playerid,Textdraw0[playerid], 1); PlayerTextDrawBoxColor(playerid,Textdraw0[playerid], -16776961); PlayerTextDrawTextSize(playerid,Textdraw0[playerid], 635.000000, 36.000000); PlayerTextDrawShow(playerid,Textdraw0[playerid]); //Shows the specefic player the textdraw Textdraw1[playerid] = CreatePlayerTextDraw(playerid,510.000000, 113.000000, "Armour"); PlayerTextDrawBackgroundColor(playerid,Textdraw1[playerid], 255); PlayerTextDrawFont(playerid,Textdraw1[playerid], 1); PlayerTextDrawLetterSize(playerid,Textdraw1[playerid], 0.500000, 1.000000); PlayerTextDrawColor(playerid,Textdraw1[playerid], -1); PlayerTextDrawSetOutline(playerid,Textdraw1[playerid], 1); PlayerTextDrawSetProportional(playerid,Textdraw1[playerid], 1); PlayerTextDrawUseBox(playerid,Textdraw1[playerid], 1); PlayerTextDrawBoxColor(playerid,Textdraw1[playerid], 255); PlayerTextDrawTextSize(playerid,Textdraw1[playerid], 569.000000, 0.000000); PlayerTextDrawShow(playerid,Textdraw1[playerid]); //Shows the textdraw id 1 to specific player Textdraw2[playerid] = CreatePlayerTextDraw(playerid,591.000000, 134.000000,hstring); TextDrawSetString(Text:Textdraw2[playerid],hstring); PlayerTextDrawBackgroundColor(playerid,Textdraw2[playerid], 255); PlayerTextDrawFont(playerid,Textdraw2[playerid], 1); PlayerTextDrawLetterSize(playerid,Textdraw2[playerid], 0.500000, 1.000000); PlayerTextDrawColor(playerid,Textdraw2[playerid], -1); PlayerTextDrawSetOutline(playerid,Textdraw2[playerid], 0); PlayerTextDrawSetProportional(playerid,Textdraw2[playerid], 1); PlayerTextDrawSetShadow(playerid,Textdraw2[playerid], 1); PlayerTextDrawShow(playerid,Textdraw2[playerid]); Textdraw3[playerid] = CreatePlayerTextDraw(playerid,531.000000, 130.000000,astring); PlayerTextDrawBackgroundColor(playerid,Textdraw3[playerid], 255); PlayerTextDrawFont(playerid,Textdraw3[playerid], 1); PlayerTextDrawLetterSize(playerid,Textdraw3[playerid], 0.500000, 1.000000); PlayerTextDrawColor(playerid,Textdraw3[playerid], -1); PlayerTextDrawSetOutline(playerid,Textdraw3[playerid], 0); PlayerTextDrawSetProportional(playerid,Textdraw3[playerid], 1); PlayerTextDrawSetShadow(playerid,Textdraw3[playerid], 1); PlayerTextDrawShow(playerid,Textdraw3[playerid]);