25.07.2015, 23:24
i have a save position /s and to load /l
can i do something like this
/s 0 /l 0 and /s 1 /l 1 and '/s 2 /l 2' u must donator to use this
this is mY save position
can i do something like this
/s 0 /l 0 and /s 1 /l 1 and '/s 2 /l 2' u must donator to use this
this is mY save position
Код:
YCMD:s(playerid, params[], help) { new Float:x,Float:y,Float:z,Float:angle; if(IsPlayerInAnyVehicle(playerid)) { GetVehiclePos(GetPlayerVehicleID(playerid),x,y,z); GetVehicleZAngle(GetPlayerVehicleID(playerid),angle); PPosition[playerid][XPos] = x; PPosition[playerid][YPos] = y; PPosition[playerid][ZPos] = z; PPosition[playerid][PAngle] = angle; SendClientMessage(playerid,0x22B998AA,"Position saved! Type /l to load!"); } else { GetPlayerPos(playerid,x,y,z);//Storing the player's position into x,y,z; GetPlayerFacingAngle(playerid,angle);//Storing the player's angle to "angle". PPosition[playerid][XPos] = x;//Storing the x value to XPos array, where we previously created. PPosition[playerid][YPos] = y;//Storing the y value to YPos array, where we previously created. PPosition[playerid][ZPos] = z;//Storing the z value to ZPos array, where we previously created. PPosition[playerid][PAngle] = angle;//Storing the angle value to PAngle array, where we previously created. SendClientMessage(playerid,0x22B998AA,"Position saved! Type /l to load!"); } PPosition[playerid][SavedPosition] = 1; return 1; } YCMD:l(playerid, params[], help) { if(PPosition[playerid][SavedPosition] == 0) return SendClientMessage(playerid,-1,"You don't have any position saved! (/s)"); if(IsPlayerInAnyVehicle(playerid))//Checking if the player is in any vehicle, so we can retrieve the vehicle's position { SetVehiclePos(GetPlayerVehicleID(playerid),PPosition[playerid][XPos],PPosition[playerid][YPos],PPosition[playerid][ZPos]);//Setting the vehicle's position with the stored one. SetVehicleZAngle(GetPlayerVehicleID(playerid),PPosition[playerid][PAngle]);//Setting the vehicle's Z angle with the stored one. SendClientMessage(playerid,0x22B998AA,"Position loaded!"); } else { SetPlayerPos(playerid,PPosition[playerid][XPos],PPosition[playerid][YPos],PPosition[playerid][ZPos]);//Setting the player's position with the stored one. SetPlayerFacingAngle(playerid,PPosition[playerid][PAngle]);//Setting the player's facing angle with the stored one. SendClientMessage(playerid,0x22B998AA,"Position loaded!"); } return 1; }