if (strcmp("/yes", cmdtext, true, 10) == 0) { if(porter[player[playerid]] == -1) { SendClientMessage(player[playerid],0xFFFFFFFF,"[ERROR]There is noone who wants to teleport to you!"); } else{ new name[MAX_PLAYER_NAME+1]; GetPlayerName(playerid, name, sizeof(name)); format(string, sizeof(string), "%s (ID:%i) has accepted your teleport inquiry.", name,playerid); SendClientMessage(porter[playerid],0xFFFFFFFF,string); new Float:x,Float:y,Float:z; GetPlayerPos(playerid,x,y,z); if(IsPlayerInAnyVehicle(player[playerid])){ SetVehiclePos(GetPlayerVehicleID(player[playerid]),x+5,y,z+2); }else{ SetPlayerPos(player[playerid],x+3,y,z+2); } } porter[playerid] = -1; } return 1; } if(!strcmp(cmdtext,"/cancel",true,9)) { new name[MAX_PLAYER_NAME+1]; GetPlayerName(playerid, name, sizeof(name)); format(string, sizeof(string), "%s (ID:%i) has canceled the teleport inquiry.", name,playerid); SendClientMessage(porter[playerid],0xFFFFFFFF,string); porter[playerid] = -1; player[porter[playerid]] = -1; return 1; }
Originally Posted by cοοp
Maybe you forgot a return 0;
|
if (strcmp("/yes", cmdtext, true, 10) == 0)
{
if(porter[player[playerid]] == -1)
{
SendClientMessage(player[playerid],0xFFFFFFFF,"[ERROR]There is noone who wants to teleport to you!");
}
else
{
new name[MAX_PLAYER_NAME+1];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s (ID:%i) has accepted your teleport inquiry.", name,playerid);
SendClientMessage(porter[playerid],0xFFFFFFFF,string);
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
if(IsPlayerInAnyVehicle(player[playerid])){
SetVehiclePos(GetPlayerVehicleID(player[playerid]),x+5,y,z+2);
}
else
{
SetPlayerPos(player[playerid],x+3,y,z+2);
}
porter[playerid] = -1;
}
return 1;
}
if(!strcmp(cmdtext,"/cancel",true,9))
{
new name[MAX_PLAYER_NAME+1];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s (ID:%i) has canceled the teleport inquiry.", name,playerid);
SendClientMessage(porter[playerid],0xFFFFFFFF,string);
porter[playerid] = -1;
player[porter[playerid]] = -1;
return 1;
}
if (strcmp("/yes", cmdtext, true, 10) == 0)
{
if(porter[player[playerid]] == -1)
{
SendClientMessage(player[playerid],0xFFFFFFFF,"[ERROR]There is noone who wants to teleport to you!");
}
else
{
new name[MAX_PLAYER_NAME+1];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s (ID:%i) has accepted your teleport inquiry.", name,playerid);
SendClientMessage(porter[playerid],0xFFFFFFFF,string);
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
if(IsPlayerInAnyVehicle(player[playerid])){
SetVehiclePos(GetPlayerVehicleID(player[playerid]),x+5,y,z+2);
}
else
{
SetPlayerPos(player[playerid],x+3,y,z+2);
}
porter[playerid] = -1;
return 1;
}
Originally Posted by SEC
should i post them?
|
if(!strcmp(cmdtext, "/yes", true))
dcmd_register(playerid,params[]) { if (PlayeridLogged[playerid]) return SendClientMessage(playerid,0xFFFFFFFF,"[ERROR]You are already logged in"); //If the player is already logged in if (AccountExists(PlayerName(playerid))) return SendClientMessage(playerid,0xFFFFFFFF,"[ERROR]Account already exists, please use '/login password'.");//If account already exists if (strlen(params)==0) return SendClientMessage(playerid,0xFFFFFFFF,"[ERROR]USAGE:/register password");//If no password was specified if (AccountCreate(PlayerName(playerid),params))//We create the account with the password specified by the player { GivePlayerMoney(playerid,300); //we give the player some bonus money AccountSetInt(PlayerName(playerid),"money",300);//we save the player's money AccountSetFloat(PlayerName(playerid),"X",1674);//We save the player's position (default) AccountSetFloat(PlayerName(playerid),"Y",1447); AccountSetFloat(PlayerName(playerid),"Z",11); AccountSetFloat(PlayerName(playerid),"IP",11); new string[200]; format(string, 100, "> You succesfully registered the nickname %s with password %s", PlayerName(playerid), params); SendClientMessage(playerid,0xFFFFFFFF,string); new Hour, Minute, Second; gettime(Hour, Minute, Second); new string2[200]; format(string2, sizeof(string2), "[%02d:%02d:%02d] %s has registered with password %s ",Hour,Minute,Second, PlayerName(playerid), params); printf(string2); return SendClientMessage(playerid,0xFFFFFFFF,"Login with '/login password' now."); } return true; } dcmd_login(playerid,params[]) { if (PlayeridLogged[playerid]) return SendClientMessage(playerid,0xFFFFFFFF," You are already logged in");//If the player is already logged in if (!AccountExists(PlayerName(playerid))) return SendClientMessage(playerid,0xFFFFFFFF,"> Account does not exist, please use '/register password'.");//If the account does not exist if (strlen(params)==0) return SendClientMessage(playerid,0xFFFFFFFF,"[ERROR]USAGE: /login password");//If no password was specified if (AccountCheckLogin(PlayerName(playerid),params))//we verify if the login was correct { PlayeridLogged[playerid] = 1; GivePlayerMoney(playerid,AccountGetInt(PlayerName(playerid),"money"));//we give the player's money from when he last disconected return SendClientMessage(playerid,0xFFFFFFFF,"Successfully logged in!"); } return SendClientMessage(playerid,0xFFFFFFFF,"[ERROR]Login failed!"); }
public OnPlayerCommandText(playerid, cmdtext[]) { dcmd(register, 8, cmdtext); dcmd(login, 5, cmdtext); return 0; }
Originally Posted by [_PGB_
Spatrik ]
pawn Код:
|
if(!strcmp(cmdtext, "/yes", true == 0))
if(!strcmp(cmdtext, "/cancel", true == 0))