SA-MP Forums Archive
/givecar command help - 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: /givecar command help (/showthread.php?tid=430831)



/givecar command help - Areax - 15.04.2013

Hello!

I need help with my /givecar command..When I type /givecar [playerid] [carid], it says: ERROR: Invalid Vehicle Model!

Code:

PHP код:
CMD:givecar(playerid,params[])
{
    new 
carid;
    new 
id;
    new 
Float:XFloat:YFloat:ZFloat:angle;
    new 
string[160];
    if(
gPlayerInfo[playerid][PLAYER_LEVEL] < 1) return SendClientMessage(playeridCOLOR_RED"You are Not Allowed To Use This Command!");
    if(
sscanf(params,"du",idcarid)) return SendClientMessage(playerid,COLOR_ORANGE,"Usage: /givecar [playerid] [carid]");
    if(!
IsPlayerConnected(id)) return SendClientMessage(playeridCOLOR_RED"ERROR: This Player is Not Connected!");
    if(
carid 400 || carid 611) return  SendClientMessage(playeridCOLOR_RED"ERROR: Invalid Vehicle Model!");
    
GetPlayerPos(idXYZ);
    
GetPlayerFacingAngle(idangle);
    
CreateVehicle(caridXYZangle0160);
    
PutPlayerInVehicle(idcarid0);
    
format(stringsizeof(string), "[INFO]: Administrator %s Has Spawned a Vehicles id %d To %s."GetName(playerid), caridGetName(id));
    
SendClientMessageToAll(COLOR_PURPLEstring);
    return 
1;

Thanks


AW: /givecar command help - ulbi1990 - 15.04.2013

pawn Код:
if(sscanf(params,"du",id, carid)) return SendClientMessage(playerid,COLOR_ORANGE,"Usage: /givecar [playerid] [carid]");
Your sscanf is in wrong direction it should be:

pawn Код:
if(sscanf(params,"ud",id, carid)) return SendClientMessage(playerid,COLOR_ORANGE,"Usage: /givecar [playerid] [carid]");
Quote:

i, d Integer 1, 42, -10

Quote:

u User name/id (bots and players) ******, 0




Re: /givecar command help - Areax - 15.04.2013

Thanks you!


Re: /givecar command help - faiznurfaza - 15.04.2013

PHP код:
CMD:givecar(playerid,params[]) 

    if(
IsPlayerAdmin(playerid)) return SendClientMessage(playeridCOLOR_RED"You Not Admin");
    new 
carid
    new 
id
    new 
Float:XFloat:YFloat:ZFloat:angle
    new 
string[160]; 
    if(
gPlayerInfo[playerid][PLAYER_LEVEL] < 1) return SendClientMessage(playeridCOLOR_RED"You are Not Allowed To Use This Command!"); 
    if(
sscanf(params,"ud",idcarid)) return SendClientMessage(playerid,COLOR_ORANGE,"Usage: /givecar [playerid] [carid]"); 
    if(!
IsPlayerConnected(id)) return SendClientMessage(playeridCOLOR_RED"ERROR: This Player is Not Connected!"); 
    if(
carid 400 || carid 611) return  SendClientMessage(playeridCOLOR_RED"ERROR: Invalid Vehicle Model!"); 
    
GetPlayerPos(idXYZ); 
    
GetPlayerFacingAngle(idangle); 
    
CreateVehicle(caridXYZangle0160); 
    
PutPlayerInVehicle(idcarid0); 
    
format(stringsizeof(string), "[INFO]: Administrator %s Has Spawned a Vehicles id %d To %s."GetName(playerid), caridGetName(id)); 
    
SendClientMessageToAll(COLOR_PURPLEstring); 
    return 
1




Re : Re: /givecar command help - DaTa[X] - 15.04.2013

Quote:
Originally Posted by faiznurfaza
Посмотреть сообщение
PHP код:
CMD:givecar(playerid,params[]) 

    if(
IsPlayerAdmin(playerid)) return SendClientMessage(playeridCOLOR_RED"You Not Admin");
    new 
carid
    new 
id
    new 
Float:XFloat:YFloat:ZFloat:angle
    new 
string[160]; 
    if(
gPlayerInfo[playerid][PLAYER_LEVEL] < 1) return SendClientMessage(playeridCOLOR_RED"You are Not Allowed To Use This Command!"); 
    if(
sscanf(params,"ud",idcarid)) return SendClientMessage(playerid,COLOR_ORANGE,"Usage: /givecar [playerid] [carid]"); 
    if(!
IsPlayerConnected(id)) return SendClientMessage(playeridCOLOR_RED"ERROR: This Player is Not Connected!"); 
    if(
carid 400 || carid 611) return  SendClientMessage(playeridCOLOR_RED"ERROR: Invalid Vehicle Model!"); 
    
GetPlayerPos(idXYZ); 
    
GetPlayerFacingAngle(idangle); 
    
CreateVehicle(caridXYZangle0160); 
    
PutPlayerInVehicle(idcarid0); 
    
format(stringsizeof(string), "[INFO]: Administrator %s Has Spawned a Vehicles id %d To %s."GetName(playerid), caridGetName(id)); 
    
SendClientMessageToAll(COLOR_PURPLEstring); 
    return 
1

use [/pawn] instead of [PHP]


Re: /givecar command help - faiznurfaza - 15.04.2013

-_- sorry i not see function if player not admin


Re : Re: /givecar command help - DaTa[X] - 15.04.2013

Quote:
Originally Posted by faiznurfaza
Посмотреть сообщение
-_- sorry i not see function if player not admin
pawn Код:
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You Not Admin");