PDA

View Full Version : Help OnPlayer Connect


Naresh
11/08/2014, 10:29 AM
// Setup local variables
new Name[MAX_PLAYER_NAME], NewPlayerMsg[128], HouseID, IP;

// Setup a PVar to allow cross-script money-transfers (only from filterscript to this mainscript) and scorepoints
SetPVarInt(playerid, "PVarMoney", 0);
SetPVarInt(playerid, "PVarScore", 0);

// Get the playername
GetPlayerName(playerid, Name, sizeof(Name));
// Also store this name for the player
GetPlayerName(playerid, APlayerData[playerid][PlayerName], 24);
// Add the IP of the player to the list
GetPlayerIp(playerid, IP, sizeof(IP));

Errors -

F:\TW-Server Related\Scripting\Trucking World\gamemodes\TW.pwn(397) : error 035: argument type mismatch (argument 2)
F:\TW-Server Related\Scripting\Trucking World\gamemodes\TW.pwn(397) : error 035: argument type mismatch (argument 2)

CutX
11/08/2014, 10:32 AM
// Setup local variables
new Name[MAX_PLAYER_NAME], NewPlayerMsg[128], HouseID, IP;

// Setup a PVar to allow cross-script money-transfers (only from filterscript to this mainscript) and scorepoints
SetPVarInt(playerid, "PVarMoney", 0);
SetPVarInt(playerid, "PVarScore", 0);

// Get the playername
GetPlayerName(playerid, Name, sizeof(Name));
// Also store this name for the player
GetPlayerName(playerid, APlayerData[playerid][PlayerName], 24);
// Add the IP of the player to the list
GetPlayerIp(playerid, IP, sizeof(IP));

Errors -

F:\TW-Server Related\Scripting\Trucking World\gamemodes\TW.pwn(397) : error 035: argument type mismatch (argument 2)
F:\TW-Server Related\Scripting\Trucking World\gamemodes\TW.pwn(397) : error 035: argument type mismatch (argument 2)




The IP is a string cuz its got dots.
You have to do it like this

new IP[16];
GetPlayerIp(playerid, IP, sizeof(IP));