Problem :s
#1

In my var bombowner[128][MAX_VEHICLES] I store the name of a player, so why am i getting this error?
pawn Код:
public Explodevehicle(playerid)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        new Float:x,Float:y,Float:z,string[200],vehicle;
        vehicle = GetPlayerVehicleID(playerid);
        GetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
        CreateExplosion(x,y,z,2,10.0);
        bombed[GetPlayerVehicleID(playerid)] = 0;
        format(string,sizeof(string),"~w~Your ~h~~r~%s ~y~has been ~g~~h~exploded with ~b~~h~%s ~g~~h~inside!",GetVehicleName(bombed[GetPlayerVehicleID(playerid)]),GetPName(playerid));
        GameTextForPlayer(bombowner[vehicle],string,4000,3);
    }
    return 1;
}
Код:
C:\Users\Admin\Desktop\test server\gamemodes\gamemode.pwn(5259) : error 035: argument type mismatch (argument 1)
error line
pawn Код:
GameTextForPlayer(bombowner[vehicle],string,4000,3);
Reply
#2

Since you cannot send a GameText to a player using his name, or atleast not in this way, you have to use the playerid.
Reply
#3

Quote:
Originally Posted by Alby Fire
Посмотреть сообщение
Since you cannot send a GameText to a player using his name, or atleast not in this way, you have to use the playerid.
So how would you do it then?
Reply
#4

Try use:

pawn Код:
new bombowner[MAX_PLAYERS];
Reply
#5

Quote:
Originally Posted by Stigg
Посмотреть сообщение
Try use:

pawn Код:
new bombowner[MAX_PLAYERS];
No because i would get more errors, because im storing a name into a var and that means i need some like it would have to be bombowner[128][MAX_VEHICLES]... never mind you dont get my script...
But i fixed it my self...
pawn Код:
public Explodevehicle(playerid)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        new Float:x,Float:y,Float:z,string[200],player;
        GetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
        player = bombownerid[GetPlayerVehicleID(playerid)];
        CreateExplosion(x,y,z,2,10.0);
        bombed[GetPlayerVehicleID(playerid)] = 0;
        format(string,sizeof(string),"~w~Your ~h~~r~%s ~y~has been ~g~~h~exploded with ~b~~h~%s ~g~~h~inside!",GetVehicleName(bombed[GetPlayerVehicleID(playerid)]),GetPName(playerid));
        GameTextForPlayer(player,string,4000,3);
    }
    return 1;
}
Made a new var.
Reply
#6

Facepalm...
GameTextForPlayer is made to show the text to a PLAYER, not to a vehicle!!
Then in the first case it would be tha same as doing
pawn Код:
GameTextForPlayer("Carrot",string,4000,3);
Totally wrong, and in the #2 it doesn't give any error since you put an int instead of a string in the first field, but it would not work since will give the GameText only for the player who has the same ID as the vehicle...
Then you have to put the variable "playerid" if you wanna send the GameText to the right player
pawn Код:
GameTextForPlayer(playerid,string,4000,3);
If pawn doesn't give you any error it doesn't mean that the problem is fixed.
Reply
#7

Quote:
Originally Posted by Alby Fire
Посмотреть сообщение
Facepalm...
GameTextForPlayer is made to show the text to a PLAYER, not to a vehicle!!
Then in the first case it would be tha same as doing
pawn Код:
GameTextForPlayer("Carrot",string,4000,3);
Totally wrong, and in the #2 it doesn't give any error since you put an int instead of a string in the first field, but it would not work since will give the GameText only for the player who has the same ID as the vehicle...
Then you have to put the variable "playerid" if you wanna send the GameText to the right player
pawn Код:
GameTextForPlayer(playerid,string,4000,3);
If pawn doesn't give you any error it doesn't mean that the problem is fixed.
x2 Facepalm IT WASN'T FOR A VEHICLE, it was retrieving the name of a player stored in a array -.-
Reply
#8

Quote:
Originally Posted by Carrot
Посмотреть сообщение
x2 Facepalm IT WASN'T FOR A VEHICLE, it was retrieving the name of a player stored in a array -.-
Writing with you is the same as writing with a 5 years old kid... you tried to show the GameText to a string, only someone who just opened pawn can do that, you should shut up instead of complaining and trying to show yourself as the "master"...
Reply
#9

i think i may know whats the problem, you should remove the [128] from your var cause it wont be any use. (unless you want to save a players name)

see your putting the var in the wrong place accually, your putting it where the playerid is suppost to be


GameTextForPlayer("variable that saves the playerid here",string,4000,3);

so just make the var save the playerid instead of playername.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)