Quote:
Originally Posted by Backwardsman97
Well if you declare the variable a in the command, it's scope will be limited to that command. You would need something like a PVar.
pawn Код:
if(!strcmp(cmd, "/plant", true)) { if(GetPVarInt(playerid,"WeedID") != -1) { //They already planted one return 1; } new Float:X, Float:Y, Float:Z, Float:A; GetPlayerFacingAngle(playerid,A); GetPlayerPos(playerid, X, Y, Z); X += (4 * floatsin(-A, degrees)); Y += (4 * floatcos(-A, degrees)); SetPVarInt(playerid,"WeedID",CreateObject(688, X, Y, Z, 0.0, 0.0, 96.0)); return 1; } if(!strcmp(cmd, "/pickweed", true)) { if(GetPVarInt(playerid,"WeedID") == -1) { //They haven't planted one return 1; } DestroyObject(GetPVarInt(playerid,"WeedID")); SetPVarInt(playerid,"WeedID",-1); //Rest of your pick weed code return 1; }
|
Hmm... I'd like to use this but i never paid attention to PVar, so i don't exactly know how
that works. And what do you exactly mean with the -1, can it just be 10 or something?