Some question - 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)
+--- Thread: Some question (
/showthread.php?tid=583105)
Some question -
anassmaroc - 25.07.2015
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
Код:
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;
}
Re: Some question -
TwinkiDaBoss - 25.07.2015
You mean double command?
pawn Код:
YCMD:l(playerid,params[],help)
{
new number;
if(sscanf(params,"i",number))
return SendClientMessage(playerid,COLOR_RED,"Usage: /l [1-2]");
if(PlayerVIP[playerid] == 0)
return SendClientMessage(playerid,COLOR_RED,"You are not VIP");
if(Number == 1)
{
//code here if player type 1
}
else if(Number == 2)
{
//code here if player type 2
}
else if(Number >= 3)
return SendClientMessage(playerid,COLOR_RED,"You cant above 2!");
return true;
}
Re : Some question -
anassmaroc - 25.07.2015
yes something like this
Re : Some question -
anassmaroc - 26.07.2015
any help?
Re: Some question -
xVIP3Rx - 26.07.2015
pawn Код:
#define MAX_POSITION_SAVES 5
new Float:PlayerPos[MAX_PLAYERS][MAX_POSITION_SAVES][4],
bool:PlayerPosUsed[MAX_PLAYERS][MAX_POSITION_SAVES];
CMD:s(playerid, params[], help)
{
new id;
if(sscanf(params,"i",id)) return SendClientMessage(playerid,COLOR_RED,"Usage: /s [Number]");
new Float:x,Float:y,Float:z,Float:angle;
if(IsPlayerInAnyVehicle(playerid))
{
GetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
GetVehicleZAngle(GetPlayerVehicleID(playerid),angle);
}
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".
}
PlayerPos[playerid][id][0] = x;
PlayerPos[playerid][id][1] = y;
PlayerPos[playerid][id][2] = z;
PlayerPos[playerid][id][3] = angle;
PlayerPosUsed[playerid][id] = true;
SendClientMessage(playerid,0x22B998AA,"Position saved! Type /l to load!");
return 1;
}
CMD:l(playerid, params[], help)
{
new id;
if(sscanf(params,"i",id)) return SendClientMessage(playerid,COLOR_RED,"Usage: /l [Number]");
if(!PlayerPosUsed[playerid][id]) 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),PlayerPos[playerid][id][0],PlayerPos[playerid][id][1],PlayerPos[playerid][id][2]);//Setting the vehicle's position with the stored one.
SetVehicleZAngle(GetPlayerVehicleID(playerid),PlayerPos[playerid][id][3]);//Setting the vehicle's Z angle with the stored one.
}
else
{
SetPlayerPos(playerid,PlayerPos[playerid][id][0],PlayerPos[playerid][id][1],PlayerPos[playerid][id][2]);//Setting the player's position with the stored one.
SetPlayerFacingAngle(playerid,PlayerPos[playerid][id][3]);//Setting the player's facing angle with the stored one.
}
SendClientMessage(playerid,0x22B998AA,"Position loaded!");
return 1;
}