SA-MP Forums Archive
OnPlayerEnterVehicle - 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: OnPlayerEnterVehicle (/showthread.php?tid=373424)



OnPlayerEnterVehicle - CrazyChoco - 30.08.2012

Hello, im making it like it will send the positions from playerid moving in a vehicle, and my code is:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    SendClientMessageToAll(-1, "{FF00FF}[VEHICLE]:{FFFFFF} %d is moving to the following pos: %d, %d, %d", playerid, x, y, z);
    return 1;
}
but i get those warnings
Quote:

C:\Users\Kajinth\Desktop\San Andreas Roleplay Cops Robbers\gamemodes\SARCR.pwn(30 : warning 202: number of arguments does not match definition
C:\Users\Kajinth\Desktop\San Andreas Roleplay Cops Robbers\gamemodes\SARCR.pwn(30 : warning 202: number of arguments does not match definition
C:\Users\Kajinth\Desktop\San Andreas Roleplay Cops Robbers\gamemodes\SARCR.pwn(30 : warning 202: number of arguments does not match definition
C:\Users\Kajinth\Desktop\San Andreas Roleplay Cops Robbers\gamemodes\SARCR.pwn(30 : warning 202: number of arguments does not match definition

All the warnings is on the "SendClientMessageToAll"


Re: OnPlayerEnterVehicle - Emmet_ - 30.08.2012

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
   
    new szString[128];
    format(szString, sizeof(szString), "{FF00FF}[VEHICLE]:{FFFFFF} %d is moving to the following pos: %d, %d, %d", playerid, x, y, z);
    SendClientMessageToAll(-1, szString);
    return 1;
}



Re: OnPlayerEnterVehicle - HuSs3n - 30.08.2012

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new Float:x, Float:y, Float:z,str[128];
    GetPlayerPos(playerid, x, y, z);
    format(str,sizeof(str),"{FF00FF}[VEHICLE]:{FFFFFF} %d is moving to the following pos: %f, %f, %f", playerid, x, y, z);
    SendClientMessageToAll(-1, str);
    return 1;
}



Re: OnPlayerEnterVehicle - doreto - 30.08.2012

You cant use it like that you first need to format it then send it and %f is for fload and %d is for integer

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new Float:x, Float:y, Float:z,string[128];
    GetPlayerPos(playerid, x, y, z);
    format(string,sizeof(string),"{FF00FF}[VEHICLE]:{FFFFFF} %d is moving to the following pos: %f, %f, %f",playerid, x, y, z);
    SendClientMessageToAll(-1,string);
    return 1;
}



Re: OnPlayerEnterVehicle - Cena44 - 30.08.2012

BTW
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
Is called when a player BEGINS to enter a vehicle, right after he clicks Enter, if you want to the text to be sent when he finishes entering (engine start) you should use:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)



Re: OnPlayerEnterVehicle - CrazyChoco - 30.08.2012

how can i make it like, it send him every 5 second?


Re: OnPlayerEnterVehicle - CrazyChoco - 30.08.2012

Bump!


Re: OnPlayerEnterVehicle - XtremeR - 30.08.2012

pawn Код:
SetTimerEx("Message",5000,true); // 5 secs timer
pawn Код:
public Message()
{
    new Float:x, Float:y, Float:z,string[128];
    GetPlayerPos(playerid, x, y, z);
    format(string,sizeof(string),"{FF00FF}[VEHICLE]:{FFFFFF} %d is moving to the following pos: %f, %f, %f",playerid, x, y, z);
    SendClientMessageToAll(-1,string);
}
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new Float:x, Float:y, Float:z,string[128];
    GetPlayerPos(playerid, x, y, z);
    format(string,sizeof(string),"{FF00FF}[VEHICLE]:{FFFFFF} %d is moving to the following pos: %f, %f, %f",playerid, x, y, z);
    SendClientMessageToAll(-1,string);
    Message(); //5 secs timer
    return 1;
}
+Rep if that helped please


Re: OnPlayerEnterVehicle - HuSs3n - 30.08.2012

Quote:
Originally Posted by XtremeR
Посмотреть сообщение
pawn Код:
SetTimer("Message",5000,true); // 5 secs timer
pawn Код:
public Message()
{
    new Float:x, Float:y, Float:z,string[128];
    GetPlayerPos(playerid, x, y, z);
    format(string,sizeof(string),"{FF00FF}[VEHICLE]:{FFFFFF} %d is moving to the following pos: %f, %f, %f",playerid, x, y, z);
    SendClientMessageToAll(-1,string);
}
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new Float:x, Float:y, Float:z,string[128];
    GetPlayerPos(playerid, x, y, z);
    format(string,sizeof(string),"{FF00FF}[VEHICLE]:{FFFFFF} %d is moving to the following pos: %f, %f, %f",playerid, x, y, z);
    SendClientMessageToAll(-1,string);
    Message(); //5 secs timer
    return 1;
}
+Rep if that helped please
Thats wrong
use SetTimerEx instead


Re: OnPlayerEnterVehicle - XtremeR - 30.08.2012

my bad Thanks HuSs3n