OnPlayerEnterVehicle
#1

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"
Reply
#2

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;
}
Reply
#3

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;
}
Reply
#4

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;
}
Reply
#5

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)
Reply
#6

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

Bump!
Reply
#8

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
Reply
#9

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
Reply
#10

my bad Thanks HuSs3n
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)