SA-MP Forums Archive
[HELP]need /back and /v command - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP]need /back and /v command (/showthread.php?tid=262289)



[HELP]need /back and /v command - Horrible - 17.06.2011

hello i am horrible again
i use this command to go stunt on my gamemode

Quote:

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/stunt", cmdtext, true, 10) == 0)
{
SetPlayerPos(playerid, -1114.1460, 378.5243, 14.1484);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid,12);
SendClientMessage(playerid, -1,""#COL_WHITE"Sekarang Anda Telah Memasuki "#COL_RED"/stunt");
return 1;

but the problem is
1. i dunno how to /back (tele player to the place when he type /stunt)
2. i dunno how to /v [spawn car] (only at stunt) Example:/v turismo

please help me


Re: [HELP]need /back and /v command - sim_sima - 17.06.2011

pawn Код:
new Float:x, Float:y, Float:z;

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/stunt", cmdtext, true, 10) == 0)
{
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, -1114.1460, 378.5243, 14.1484);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid,12);
SendClientMessage(playerid, -1,""#COL_WHITE"Sekarang Anda Telah Memasuki "#COL_RED"/stunt");
}
if (strcmp("/back", cmdtext, true, 10) == 0)
{
SetPlayerPos(playerid, x, y, z);
}

return 1;
But i would recommend you using zcmd in stead.


Re: [HELP]need /back and /v command - Horrible - 18.06.2011

Thx sim_sima

and can some one answer second question?


Re: [HELP]need /back and /v command - maramizo - 18.06.2011

On top
pawn Код:
#include <zcmd>
#include <sscanf2>
At the bottom
pawn Код:
CMD:v(playerid, params[])
{
    new vid;
    if(sscanf(params,"i",vid)) return SendClientMessage(playerid, -1, "USAGE: /v [VehicleID]");
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    CreateVehicle(vid, x, y+5, z, 0.0000, 0, 0, 0);
    return 1;
}



Re: [HELP]need /back and /v command - Horrible - 18.06.2011

Quote:
Originally Posted by maramizo
Посмотреть сообщение
On top
pawn Код:
#include <zcmd>
#include <sscanf2>
At the bottom
pawn Код:
CMD:v(playerid, params[])
{
    new vid;
    if(sscanf(params,"i",vid)) return SendClientMessage(playerid, -1, "USAGE: /v [VehicleID]");
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    CreateVehicle(vid, x, y+5, z, 0.0000, 0, 0, 0);
    return 1;
}
that input on my game mode? at bottom of this?
Quote:

new Float, Float:y, Float:z;

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/stunt", cmdtext, true, 10) == 0)
{
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, -1114.1460, 378.5243, 14.1484);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid,12);
SendClientMessage(playerid, -1,""#COL_WHITE"Sekarang Anda Telah Memasuki "#COL_RED"/stunt");
}
if (strcmp("/back", cmdtext, true, 10) == 0)
{
SetPlayerPos(playerid, x, y, z);
}

return 1;

Quote:

C:\Documents and Settings\User\Desktop\Server SA-MP OPEN BETA(ary)\gamemodes\tombodos.pwn(180) : error 017: undefined symbol "SetPlayerTeamFromClass"
C:\Documents and Settings\User\Desktop\Server SA-MP OPEN BETA(ary)\gamemodes\tombodos.pwn(447) : error 017: undefined symbol "SetPlayerMoney"
C:\Documents and Settings\User\Desktop\Server SA-MP OPEN BETA(ary)\gamemodes\tombodos.pwn(44 : error 017: undefined symbol "SetPlayerToTeamColor"
C:\Documents and Settings\User\Desktop\Server SA-MP OPEN BETA(ary)\gamemodes\tombodos.pwn(489) : error 029: invalid expression, assumed zero
C:\Documents and Settings\User\Desktop\Server SA-MP OPEN BETA(ary)\gamemodes\tombodos.pwn(489) : error 017: undefined symbol "cmd_v"
C:\Documents and Settings\User\Desktop\Server SA-MP OPEN BETA(ary)\gamemodes\tombodos.pwn(489) : error 029: invalid expression, assumed zero
C:\Documents and Settings\User\Desktop\Server SA-MP OPEN BETA(ary)\gamemodes\tombodos.pwn(489) : fatal error 107: too many error messages on one line

i am want /v only at /stunt

please help...................


Re: [HELP]need /back and /v command - PrawkC - 18.06.2011

You need ZCMD and sscanf

Put these at the top of your script, it may also be a good idea to make them equal 0 on player disconnect
pawn Код:
new Float:pPos[MAX_PLAYERS][3]; //Array for xyz, 0 = x, 1 = y, 2 = z
new pInt[MAX_PLAYERS]; // The interior the player was in
pawn Код:
CMD:stunt(playerid, params[])
{
    GetPlayerPos(playerid, pPos[playerid][0], pPos[playerid][1], pPos[playerid][2]); //Stores the players positons in an array
    pInt[playerid] = GetPlayerInterior(playerid); //Stores the players interior
    SetPlayerPos(playerid, -1114.1460, 378.5243, 14.1484);
    SetPlayerInterior(playerid, 0);
    SendClientMessage(playerid, -1,"Sekarang Anda Telah Memasuki /stunt");
    return 1;
}

CMD:back(playerid, params[])
{
    if(!IsPlayerInRangeOfPoint(playerid, 50.0, -1114.1460, 378.5243, 14.1484)) return SendClientMessage(playerid, -1, "You must be near the stunt course!");
    SetPlayerPos(playerid, pPos[playerid][0], pPos[playerid][1], pPos[playerid][2]); //Sets the players position to the position we saved in /stunt
    SetPlayerInterior(playerid, pInt[playerid]); //Sets the interior to the one we saved in /stunt
    return 1;
}

CMD:v(playerid, params[])
{
    new carId, Float:x, Float:y, Float:z;
    if(sscanf(params, "i", carId)) return SendClientMessage(playerid, -1, "Syntax: /v carId");
    if(carId < 400 || carId > 611) return SendClientMessage(playerid, -1, "Invalid car Id, (400 - 611)");
    if(!IsPlayerInRangeOfPoint(playerid, 15.0, -1114.1460, 378.5243, 14.1484)) return SendClientMessage(playerid, -1, "You must be near the stunt course!"); //This checks if you're near the stun area
    GetPlayerPos(playerid, x, y, z);
    CreateVehicle(carId, x, y + 5, z, 0,-1, -1, -1);
    SendClientMessage(playerid, -1, "Car spawned at your location!");
    return 1;
}



Re: [HELP]need /back and /v command - Horrible - 18.06.2011

Quote:
Originally Posted by PrawkC
Посмотреть сообщение
You need ZCMD and sscanf

Put these at the top of your script, it may also be a good idea to make them equal 0 on player disconnect
pawn Код:
new Float:pPos[MAX_PLAYERS][3]; //Array for xyz, 0 = x, 1 = y, 2 = z
new pInt[MAX_PLAYERS]; // The interior the player was in
pawn Код:
CMD:stunt(playerid, params[])
{
    GetPlayerPos(playerid, pPos[playerid][0], pPos[playerid][1], pPos[playerid][2]); //Stores the players positons in an array
    pInt[playerid] = GetPlayerInterior(playerid); //Stores the players interior
    SetPlayerPos(playerid, -1114.1460, 378.5243, 14.1484);
    SetPlayerInterior(playerid, 0);
    SendClientMessage(playerid, -1,"Sekarang Anda Telah Memasuki /stunt");
    return 1;
}

CMD:back(playerid, params[])
{
    if(!IsPlayerInRangeOfPoint(playerid, 50.0, -1114.1460, 378.5243, 14.1484)) return SendClientMessage(playerid, -1, "You must be near the stunt course!");
    SetPlayerPos(playerid, pPos[playerid][0], pPos[playerid][1], pPos[playerid][2]); //Sets the players position to the position we saved in /stunt
    SetPlayerInterior(playerid, pInt[playerid]); //Sets the interior to the one we saved in /stunt
    return 1;
}

CMD:v(playerid, params[])
{
    new carId, Float:x, Float:y, Float:z;
    if(sscanf(params, "i", carId)) return SendClientMessage(playerid, -1, "Syntax: /v carId");
    if(carId < 400 || carId > 611) return SendClientMessage(playerid, -1, "Invalid car Id, (400 - 611)");
    if(!IsPlayerInRangeOfPoint(playerid, 15.0, -1114.1460, 378.5243, 14.1484)) return SendClientMessage(playerid, -1, "You must be near the stunt course!"); //This checks if you're near the stun area
    GetPlayerPos(playerid, x, y, z);
    CreateVehicle(carId, x, y + 5, z, 0,-1, -1, -1);
    SendClientMessage(playerid, -1, "Car spawned at your location!");
    return 1;
}
i must make new filterscript?if i must make new filtersript where must i put that code?or if i must on put on my gamemode where i must input?


Re: [HELP]need /back and /v command - alpha500delta - 18.06.2011

No you put it somewhere in your script (not in a callback)

Also, Don't you need PVars to store something?


Re: [HELP]need /back and /v command - Horrible - 18.06.2011

i input that code on my game mode
Quote:

public OnPlayerCommandText(playerid, cmdtext[])
{
CMDtunt(playerid, params[])
{
GetPlayerPos(playerid, pPos[playerid][0], pPos[playerid][1], pPos[playerid][2]); //Stores the players positons in an array
pInt[playerid] = GetPlayerInterior(playerid); //Stores the players interior
SetPlayerPos(playerid, -1114.1460, 378.5243, 14.1484);
SetPlayerInterior(playerid, 0);
SendClientMessage(playerid, -1,"Sekarang Anda Telah Memasuki /stunt");
return 1;
}

CMD:back(playerid, params[])
{
if(!IsPlayerInRangeOfPoint(playerid, 50.0, -1114.1460, 378.5243, 14.1484)) return SendClientMessage(playerid, -1, "You must be near the stunt course!");
SetPlayerPos(playerid, pPos[playerid][0], pPos[playerid][1], pPos[playerid][2]); //Sets the players position to the position we saved in /stunt
SetPlayerInterior(playerid, pInt[playerid]); //Sets the interior to the one we saved in /stunt
return 1;
}

CMD:v(playerid, params[])
{
new carId, Float, Float:y, Float:z;
if(sscanf(params, "i", carId)) return SendClientMessage(playerid, -1, "Syntax: /v carId");
if(carId < 400 || carId > 611) return SendClientMessage(playerid, -1, "Invalid car Id, (400 - 611)");
if(!IsPlayerInRangeOfPoint(playerid, 15.0, -1114.1460, 378.5243, 14.1484)) return SendClientMessage(playerid, -1, "You must be near the stunt course!"); //This checks if you're near the stun area
GetPlayerPos(playerid, x, y, z);
CreateVehicle(carId, x, y + 5, z, 0,-1, -1, -1);
SendClientMessage(playerid, -1, "Car spawned at your location!");
return 1;
}

but pawno said this:
Quote:

C:\Documents and Settings\User\Desktop\Server SA-MP OPEN BETA(ary)\gamemodes\tombodos.pwn(477) : error 029: invalid expression, assumed zero
C:\Documents and Settings\User\Desktop\Server SA-MP OPEN BETA(ary)\gamemodes\tombodos.pwn(477) : error 017: undefined symbol "cmd_stunt"
C:\Documents and Settings\User\Desktop\Server SA-MP OPEN BETA(ary)\gamemodes\tombodos.pwn(477) : error 029: invalid expression, assumed zero
C:\Documents and Settings\User\Desktop\Server SA-MP OPEN BETA(ary)\gamemodes\tombodos.pwn(477) : fatal error 107: too many error messages on one line

please help....................


Re: [HELP]need /back and /v command - ricardo178 - 18.06.2011

You are not remembering something....
If you use strcmc and zcmd in the same script, strcmp will not work anymore...
Well, i don't remember as well which one will stop working, but one of them is.


Re: [HELP]need /back and /v command - Horrible - 18.06.2011

Quote:
Originally Posted by ricardo178
Посмотреть сообщение
You are not remembering something....
If you use strcmc and zcmd in the same script, strcmp will not work anymore...
Well, i don't remember as well which one will stop working, but one of them is.
i already remove strcmp but same errors

why zcmd not work?
Quote:

C:\Documents and Settings\User\Desktop\Server SA-MP OPEN BETA(ary)\gamemodes\tombodos.pwn(477) : error 029: invalid expression, assumed zero
C:\Documents and Settings\User\Desktop\Server SA-MP OPEN BETA(ary)\gamemodes\tombodos.pwn(477) : error 017: undefined symbol "cmd_stunt"
C:\Documents and Settings\User\Desktop\Server SA-MP OPEN BETA(ary)\gamemodes\tombodos.pwn(477) : error 029: invalid expression, assumed zero
C:\Documents and Settings\User\Desktop\Server SA-MP OPEN BETA(ary)\gamemodes\tombodos.pwn(477) : fatal error 107: too many error messages on one line




Re: [HELP]need /back and /v command - alpha500delta - 18.06.2011

I said in my previous post, put it anywhere, but not in a callback, try it at the bottom of the script


Re: [HELP]need /back and /v command - Horrible - 19.06.2011

Done.......(with error edited by me)

if player go /stunt the player will tele to -1114.1460, 378.5243, 14.1484
and player can only use /v at that spot but i want,player can /v everywhere but must at /stunt (i already set player virtual world to 12) but i dunno how to /v only at that virtualworld then if player not on that world it say:"You must be near the stunt course!"

please help...


Re: [HELP]need /back and /v command - Horrible - 19.06.2011

please help i really need this..........................


Re: [HELP]need /back and /v command - Wesley221 - 19.06.2011

Add this:
pawn Код:
if(GetplayerVirtualWorld(playerid) != 12) return SendClientMessage(playerid, 0xFFFFFFFF, "This command can be performed in virtualworld: 12");



Re: [HELP]need /back and /v command - Horrible - 20.06.2011

Quote:
Originally Posted by Wesley221
Посмотреть сообщение
Add this:
pawn Код:
if(GetplayerVirtualWorld(playerid) != 12) return SendClientMessage(playerid, 0xFFFFFFFF, "This command can be performed in virtualworld: 12");
still cant works