20.01.2013, 09:37
(
Последний раз редактировалось Neil.; 04.02.2013 в 17:42.
)
fixed
I want to check if the ownersname currently connected is = to the vehicle data's owner
the problem is it's sending an error: 1. Array must be indexed(Variablewnername) 2. Empty Statement Being a noob an' all, I do not know how to compare two strings if they're the same, I could use strcmp but I'm still stucked like one happened up top. |
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new ownername[MAX_PLAYER_NAME];
GetPlayerName(playerid, ownername, sizeof(ownername));
if(strcmp(ownername, AVehicleData[vehicleid][Owner], true) == 0)
{
new string[128];
format(string,sizeof(string), "You are the owner of this vehicle");
SendClientMessage(playerid, 0x0FF0000AA, string);
}
return 1;
}
pawn Код:
|
As far as I'm aware you can't check strings like that, use strcmp instead.
|
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new ownername[50];
new player1;
new owner = AVehicleData[vehicleid][Owner];
GetPlayerName(player1, ownername, sizeof(ownername));
if(!strcmp(owner, "", true)) // I can't put ownername on the ""
{
new string[128];
format(string,sizeof(string), "You are not the owner of this vehicle");
SendClientMessage(playerid, 0x0FF0000AA, string);
}
return 1;
}
Still the same error :/
pawn Код:
|
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new ownername[MAX_PLAYER_NAME];
new owner = AVehicleData[vehicleid][Owner];
GetPlayerName(playerid, ownername, sizeof(ownername));
if(!strcmp(owner, owername, true)) // I can't put ownername on the ""
{
new string[128];
format(string,sizeof(string), "You are the owner of this vehicle");
SendClientMessage(playerid, 0x0FF0000AA, string);
}
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new ownername[50];
new player1;
new owner;
owner = AVehicleData[vehicleid][Owner];// symbol is assigned a value that is never used: owner
GetPlayerName(player1, ownername, sizeof(ownername));
if(!strcmp(owner,ownername , false))//argument type mismatch(argument 1)
{
new string[128];
format(string,sizeof(string), "You are not the owner of this vehicle");
SendClientMessage(playerid, 0x0FF0000AA, string);
}
return 1;
}
pawn Код:
|
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new ownername[MAX_PLAYER_NAME];
GetPlayerName(playerid, ownername, sizeof(ownername));
if(!strcmp(ownername,AVehicleData[vehicleid][Owner],false))
{
new string[128];
format(string,sizeof(string), "You are not the owner of this vehicle");
SendClientMessage(playerid, 0x0FF0000AA, string);
}
return 1;
}