I need a /s and /l
#1

Hey guys can you quikly make me a /s to save position and /l to load

I SEARCHED ****** but they all come with /pm command and if i use it my commands get messed up...
Reply
#2

pawn Code:
// Make this a global variable
new Float:Pos[MAX_PLAYERS][3]

// Place this under OnPlayerCommandText
if(strcmp("/s", true) ==0)
{
     GetPlayerPos(playerid, Pos[playerid][0], Pos[playerid][1], Pos[playerid][2]);
     return SendClientMessage(playerid, COLOR_WHITE, "[SERVER]: Your position has been saved. Use /l to load it.");
}

if(strcmp("/l", true) ==0)
{
     SetPlayerPos(playerid, Pos[playerid][0], Pos[playerid][1], Pos[playerid][2]);
     return SendClientMessage(playerid, COLOR_WHITE, "[SERVER]: Your position has been loaded.");
}
Reply
#3

how to make a global variable ?
Reply
#4

Just place it under your includes and forwards

pawn Code:
new Float:Pos[MAX_PLAYERS][3];
Reply
#5

wheres that? is that in a script?? ?
Reply
#6

Yes, example (let's say this is your script/gamemode):

pawn Code:
#include <a_samp>

new Float:Pos[MAX_PLAYERS][3]; // Here goes a global variable

main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("Blank Script");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}
Reply
#7

thanks man works :P had some errors but i fixed them...
Reply
#8

i did not want to make a new topic so can someone make it for me in ZCMDplz?
Reply
#9

Quote:
Originally Posted by [A]ndrei
View Post
i did not want to make a new topic so can someone make it for me in ZCMDplz?
.... no comments Geez :P
Here, just copy and paste it -.-'

Code:
// Make this a global variable
new Float:Pos[MAX_PLAYERS][3]

// Place this under OnPlayerCommandText
CMD:s(playerid, params[])
{
     GetPlayerPos(playerid, Pos[playerid][0], Pos[playerid][1], Pos[playerid][2]);
     return SendClientMessage(playerid, COLOR_WHITE, "[SERVER]: Your position has been saved. Use /l to load it.");
}

CMD:l(playerid, params[])
{
     SetPlayerPos(playerid, Pos[playerid][0], Pos[playerid][1], Pos[playerid][2]);
     return SendClientMessage(playerid, COLOR_WHITE, "[SERVER]: Your position has been loaded.");
}
Reply
#10

Quote:
Originally Posted by Makaveli93
View Post
pawn Code:
// Make this a global variable
new Float:Pos[MAX_PLAYERS][3]

// Place this under OnPlayerCommandText
if(strcmp("/s", true) ==0)
{
     GetPlayerPos(playerid, Pos[playerid][0], Pos[playerid][1], Pos[playerid][2]);
     return SendClientMessage(playerid, COLOR_WHITE, "[SERVER]: Your position has been saved. Use /l to load it.");
}

if(strcmp("/l", true) ==0)
{
     SetPlayerPos(playerid, Pos[playerid][0], Pos[playerid][1], Pos[playerid][2]);
     return SendClientMessage(playerid, COLOR_WHITE, "[SERVER]: Your position has been loaded.");
}
plz i get 3 erros
PHP Code:
C:\Users\MOHAMMED\Desktop\xxxxxxxxxxxxxx\gamemodes\derby.pwn(891) : error 035argument type mismatch (argument 2)
C:\Users\MOHAMMED\Desktop\xxxxxxxxxxxxxx\gamemodes\derby.pwn(897) : error 035argument type mismatch (argument 2)
C:\Users\MOHAMMED\Desktop\xxxxxxxxxxxxxx\gamemodes\derby.pwn(902) : warning 225unreachable code
C
:\Users\MOHAMMED\Desktop\xxxxxxxxxxxxxx\gamemodes\derby.pwn(902) : warning 217loose indentation
C
:\Users\MOHAMMED\Desktop\xxxxxxxxxxxxxx\gamemodes\derby.pwn(2684) : error 030compound statement not closed at the end of file (started at line 872)
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
3 Errors

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)